/**
 * @file LoggerManager.h
 * @author  haifeng ( haifengxiao@icloud.com)
 * @brief 
 * @version 0.1
 * @date 2021-07-06
 * 
 * @copyright Copyright (c) 2021
 * 
 */

#pragma once

#include <map>

#include "../../../inc/singleton.h"
#include "Logger.h"

namespace Chen{
namespace Log{

class LoggerManager{
public:
    
    /**
     * @brief Construct a new Logger Manager object
     * 
     */
    LoggerManager();
    
    /**
     * @brief Get the Logger object
     * 
     * @param name 
     * @return Logger::ptr 
     */
    Logger::ptr getLogger(const std::string &name);
    
    /**
     * @brief Get the Root object
     * 
     * @return Logger::ptr 
     */
    Logger::ptr getRoot() const { return m_root; }

    /**
     * @brief init
     * 
     */
    void init();
private:
    /// all loggers
    std::map<std::string, Logger::ptr> m_loggers;
    /// the main logger
    Logger::ptr m_root;
};
/// LoggerManager singleton
typedef Chen::Singleton<LoggerManager> LoggerMgr;

}//namespace Log
}//namespace Chen